<template>
  <div class="login-view">
    <div v-if="isChecking" class="auth-checking">
      <div class="loading-spinner"></div>
      <p>正在验证登录状态...</p>
    </div>
    <Login v-else />
  </div>
</template>

<script setup lang="ts">
import { useAutoLogin } from '@/composables/useAuth'
import Login from '@/components/LoginView/index.vue'

const { isChecking } = useAutoLogin()
</script>

<style scoped>
.login-view {
  height: 100%;
  width: 100%;
}

.auth-checking {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  background-color: var(--background-color-secondary);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-checking p {
  color: var(--text-color-secondary);
  font-size: var(--font-size-base);
}
</style>
